home *** CD-ROM | disk | FTP | other *** search
- This is the port to SAS-C of the port of GNU diff to the Amiga ( :-),
- made by Martin Hohl in September 1991, with a couple of bugs
- corrected (e.g. == instead of =). In the original Amiga.ReadMe file,
- Martin wrote:
-
- -----
-
- diff [options] file1 file2
-
- GNU diff compares the both files given in the command line and outputs
- to the standard output, which lines have to be changed in which way to
- make the second file from the first file.
-
- the most important options are:
-
- diff -a file1 file2 treat everthing as ascii
- diff -d file1 file2 find the minimal set of differences
- diff -w file1 file2 ignore any changes in whitespace (tabs + blanks)
-
- the output looks like:
- l1 a l2,l3 for lines which have to be added
- l1,l2 d l3 for lines which have to be deleted
- l1,l2 c l3,l4 for lines which have to be replaced
-
-
- Known bugs of this port:
- diff dir1 dir2 Compares of 2 directories does work, but only if
- neither dir1 or dir2 is the current directory
- ("" as argument to diff is not allowed for now)
-
- This port was done with GCC 1.37.1 (GNU-C for the Amiga, a highly
- optimizing compiler, which is free software), ported to the Amiga by
- Ray Burr, Sam Rushing and others.
-
- The author can be reached via Email:
- zrzo0370@rusmv1.rus.uni-stuttgart.de
-
- -----
-
- Thanks, Martin! Here is some more info on the GNU diff program:
-
- This directory contains the GNU DIFF utility, version 1.15, ported to
- the Amiga for the SAS C compiler, in executable form. In the
- subdirectory named Source/Diff are these files: the original GNU diff
- in archived form, GNUdiff.lha; the diff's between GNU diff and SAS C
- Amiga diff (Amiga.Patches); the SAS C Makefile; a new routine, named
- fixupname.c; and the GNU license with the copying conditions.
-
- This version of diff provides all the features of BSD's diff. It has
- these additional features:
-
- - An input file may end in a non-newline character. If so, its last
- line is called an incomplete line and is distinguished on output
- from a full line. In the default, -c, and -u output styles, an
- incomplete output line is followed by a diagnostic line that starts
- with \. With -n, an incomplete line is output without a trailing
- newline. Other output styles (-D, -e, -f) cannot represent an
- incomplete line, so they pretend that there was a newline, and -e
- and -f also print an error message. For example, suppose F and G
- are one-byte files that contain just ``f'' and ``g'', respectively.
-
- Then ``diff F G'' outputs:
-
- 1c1
- < f
- \ No newline at end of file
- ---
- > g
- \ No newline at end of file
-
- (The exact diagnostic message may differ, e.g. for non-English
- locales.) ``diff -n F G'' outputs the following without a trailing
- newline:
-
- d1 1
- a1 1
- g
-
- ``diff -e F G'' sends two diagnostics to stderr and the following to
- stdout:
-
- 1c
- g
- .
-
- - A file is considered to be text if its first characters are all in
- the ISO 8859 character set; BSD's diff uses Ascii.
-
- - An input file may end in a non-newline character. With the -m
- option, an incomplete last line stays incomplete. Other output
- styles treat incomplete lines like diff.
-
- - The file name '-' denotes the standard input. It can appear at most
- once.
-
- GNU DIFF has the following options:
-
- -a Always treat files as text and compare them line-by-line,
- even if they do not appear to be text.
-
- -b Ignore changes that affect only the amount of whitespace:
-
- -B Ignore changes that just insert or delete blank lines.
-
- -c Request context-style output.
-
- -C # Request -c format and specify number of context lines.
-
- -d Don't discard lines. This makes things slower, but will
- find a _guaranteed minimal_ set of changes.
-
- -D def Make merged #ifdef-style output.
-
- -e Make output that is a valid Unix-ed script.
-
- -f Make output that looks vaguely like an Unix-ed script.
-
- -F regexp In context format, for each unit of differences, show some
- of the last preceding line that matches the specified
- regexp.
-
- -h Split the files into chunks of about 1500 lines for faster
- processing. Usually does not change the result.
-
- -H Use heuristics to speed handling of large files that have
- numerous scattered small changes. The algorithm becomes
- asymptotically linear for such files!
-
- -i Ignore case changes.
-
- -I regexp Ignore changes that just insert or delete lines that match
- the specified regexp.
-
- -L label Use the specified label in file header lines output by the
- -c option. This option may be given zero, one, or two times,
- to affect neither label, just the first file's label, or
- both labels. A file's default label is its name, a tab, and
- its modification date.
-
- -n Outputs RCS-style diffs, like `-f' except that each command
- specifies the number of lines affected.
-
- -N In directory comparison, if a file is found in only one
- directory, treat it as present but empty in the other
- directory.
-
- -p Equivalent to -c -F'^[_a-zA-Z]'. This is useful for C code
- because it shows which function each change is in.
-
- -q Quiet running, print a message if the files differ.
-
- -r When comparing directories, recursively compare
- subdirectories.
-
- -s Print a message if the files are the same.
-
- -S When comparing directories, start with the specified
- file name. This is used for resuming an aborted comparison.
-
- -t Expand tabs to spaces in the output so that it preserves
- the alignment of the input files.
-
- -T Print a tab rather than a space before the text of a line
- in normal or context format. This causes the alignment
- of tabs in the line to look normal.
-
- -u[#] Produce unified style output with # context lines (default
- 3). This style is like -c, but it is more compact because
- context lines are printed only once. Lines from just the
- first file are marked '-'; lines from just the second file
- are marked '+'.
-
- -v Print version number.
-
- -w Ignore horizontal whitespace when comparing lines.
-
- GNU DIFF was written by Mike Haertel, David Hayes, Richard Stallman
- and Len Tower. The basic algorithm is described in: "An O(ND)
- Difference Algorithm and its Variations", Eugene Myers, Algorithmica
- Vol. 1 No. 2, 1986, p 251.
-
- Many bugs were fixed by Paul Eggert. The unified diff idea and format
- are from Wayne Davison.
-
- Suggested projects for improving GNU DIFF:
-
- * Handle very large files by not keeping the entire text in core. One
- way to do this is to scan the files sequentally to compute hash
- codes of the lines and put the lines in equivalence classes based
- only on hash code. Then compare the files normally. This will
- produce some false matches.
-
- * Then scan the two files sequentially again, checking each match to
- see whether it is real. When a match is not real, mark both the
- "matching" lines as changed. Then build an edit script as usual.
-
- * The output routines would have to be changed to scan the files
- sequentially looking for the text to print.
-